package com.batis.session;

import com.batis.config.Configuration;
import com.batis.config.MapperStatement;

/**
 * 1,加载配置信息到内存中
 *
 * @author carter
 * create time    2018-08-17
 */

public class SqlSessionFactory {

    private Configuration configuration = new Configuration();
    public static final String db_location_file = "db.properties";
    public static final String mappers_location_file = "user.xml";

    public SqlSessionFactory() {

        loadDbInfo();
        loadMappersInfo();

    }

    public SqlSession getSqlSession()
    {
        return  new DefaultSqlSession(configuration);
    }


    private void loadMappersInfo() {
        //读取 mapper xml， 加载到 mapperStatement中

    }

    private void loadDbInfo() {
        //读取 db.properties
        configuration.getStatementMap().put("",new MapperStatement());

    }
}
